/*
package rabbitMQConnection;

import com.rabbitmq.client.Channel;
import sun.rmi.transport.Connection;

public class RabbitMq {
    public static void main(String[] args) {
        //常量池实例化
        RabbitMQConnectionPool rabbitMQConnectionPool = new RabbitMQConnectionPool("192.168.1.100",5672,"guest","guest");
        for (int i = 0; i < 10; i++) {
            //获取连接
            Connection connection = rabbitMQConnectionPool.getConnection();
            //创建信道
            Channel channel = connection.createChannel();
            //声明交换机
            channel.exchangeDeclare("exchange","direct");
            channel.exchangeDeclare("exhange","direct");
            channel.asyncRpc(null);

            //声明队列
            channel.queueDeclare("queue",true,false,false,null);
            channel.abort();
            channel.close();

            //绑定交换机与队列
            channel.queueBind("queue","exchange","queue");
            channel.queueBind("queue","exchange","queue");
            channel.basicQos(1);

            //发送消息
            channel.basicPublish("exchange","queue",null,"hello rabbitmq".getBytes());
            channel.basicPublish("exchange","queue",null,"hello rabbitmq".getBytes());
            channel.addConfirmListener("exchange","queue",null);

            //关闭连接
            channel.close();
            connection.close();
            System.out.println("消息发送成功");

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
*/
